import axios from 'axios'
import JSONBig from  'json-bigint'
const http =new axios.create({
  baseURL:'http://ttapi.research.itcast.cn/',
  transformResponse:[function(data){
    try{
      return JSONBig.parse(data)
    }catch{
      return data
    }
  }]
})
http.interceptors.request.use(config=>{
  const tokenstring=`Bearer ${window.sessionStorage.getItem('token')}`
  config.headers.Authorization=tokenstring
  return config
})

export default http